package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;

@Getter
@Setter
public class StrategyComment extends BaseDomain{

    public static final Integer STATE_DISABLED = -1;
    public static final Integer STATE_NORMAL = 0;
    public static final Integer STATE_COMMEND = 1;

    private User user;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    private String content;

    private String imgUrls;

    private Integer starNum;

    private Strategy strategy;

    private Integer state = STATE_NORMAL;

    private Date commendTime;

    public String getStateName(){
        String temp = "禁用";
        if (state==0) {
            temp = "普通";
        }else if (state==1) {
            temp = "推荐";
        }
        return temp;
    }

    public String[] getImgUrlsToArray(){
        if (imgUrls != null) {
            return imgUrls.split(";");
        }
        return null;
    }

}